﻿using System;
using System.Windows.Input;

namespace Gmantis.Controls
{
    public class GRoutedEventArgs : System.Windows.RoutedEventArgs
    {
        // Fields
        private bool _handled;
        private string _routedEvent;

        // Properties
        public string EventName
        {
            get
            {
                return this._routedEvent;
            }
            internal set
            {
                this._routedEvent = value;
            }
        }

        public bool Handled
        {
            get
            {
                return this._handled;
            }
            set
            {
                this._handled = value;
            }
        }

        public object OriginalSource { get; internal set; }
    }

    public sealed class CanExecuteRoutedEventArgs : GRoutedEventArgs
    {
        // Fields
        private bool _canExecute;
        private ICommand _command;
        private bool _continueRouting;
        private object _parameter;

        // Methods
        internal CanExecuteRoutedEventArgs(ICommand command, object parameter)
        {
            if (command == null)
            {
                throw new ArgumentNullException("command");
            }
            this._command = command;
            this._parameter = parameter;
        }

        // Properties
        public bool CanExecute
        {
            get
            {
                return this._canExecute;
            }
            set
            {
                this._canExecute = value;
            }
        }

        public ICommand Command
        {
            get
            {
                return this._command;
            }
        }

        public bool ContinueRouting
        {
            get
            {
                return this._continueRouting;
            }
            set
            {
                this._continueRouting = value;
            }
        }

        public object Parameter
        {
            get
            {
                return this._parameter;
            }
        }
    }

    public sealed class ExecutedRoutedEventArgs : GRoutedEventArgs
    {
        // Fields
        private ICommand _command;
        private object _parameter;

        // Methods
        internal ExecutedRoutedEventArgs(ICommand command, object parameter)
        {
            if (command == null)
            {
                throw new ArgumentNullException("command");
            }
            this._command = command;
            this._parameter = parameter;
        }

        // Properties
        public ICommand Command
        {
            get
            {
                return this._command;
            }
        }

        public object Parameter
        {
            get
            {
                return this._parameter;
            }
        }
    }
}
